package com.mengxj.basetype;

import java.util.Arrays;
import java.util.List;

/**
 * @author mengxj
 */
public class BaseType {

    public static void main(String[] args) {
       //StringBuilder  不带synchronized
        // StringBuffer 带synchronized -> 线程安全
        String line = "hello " + 1 + " aaa";
        StringBuffer builder = new StringBuffer();
        builder.append("hello ").append(1).append(" aaa");
        System.out.println(builder.toString());
        System.out.println(2 | 3);
        System.out.println();
    }

    static void demo2(){
        //二进制  0101010101010   每八位一个bit
        //编码  UTF-8  UTF-16  ISO-8859-1  GBK
        //0   0000
        //1   0001
        //2   0010
        //3   0011
        //   |  或  有1就是1
        //   &  与  有0就是0

        // 2 | 3
        //  0010
        //  0011
        //  0011
        //  向左移动2位数字 <<
        //  0011   ->  1100

    }

    String columns(List<String> list){
        StringBuilder builder = new StringBuilder();
        for(int i = 0; i < list.size(); i ++){
            builder.append(list.get(i));
            if(i != list.size() - 1){
                builder.append(", ");
            }
        }
        return builder.toString();
    }

    static void demo1(){
        //char  a-z  A-Z   a 97 A 65
        char c1 = ' ', c2 = 'A';
        //C - c
        //回车 13 10 和 换行 区别
        char[] array = "abcd".toCharArray();
        int a = array[1] - 32;
        array[1] = (char)a;
        System.out.println(new String(array));
    }
}
